package com.rockcent.mall.lib.domain;

import com.rockcent.common.domain.IDEntityMall;
import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.enumclass.*;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * Created by HK on 16/10/10.
 */
@Table(name = "merchant_order_item")
@Entity
@DynamicUpdate
@DynamicInsert
public class MerchantOrderItem extends IDEntityMall {
    /**
     * 购买用户id
     */
    @Column(columnDefinition = "bigint comment '购买用户id'")
    private Long customerId;

    /**
     * 购买用户名称
     */
    @Column(columnDefinition = "varchar(50) comment '购买用户名称'")
    private String customerName;
    /**
     * 商家订单 id
     */
    @Column(columnDefinition = "bigint comment '商家订单 id'")
    private Long merchantOrderId;
    /**
     * 商家订单号
     */
    @Column(columnDefinition = "varchar(50) comment '商家订单号'")
    private String merchantOrderNum;
    /**
     * 商家 id
     */
    @Column(columnDefinition = "bigint comment '商家 id'")
    private Long merchantId;
    /**
     * 关联门店id
     */
    @Column(columnDefinition = "bigint comment '关联门店id'")
    private Long merchantStoreId;
    /**
     * 分销市场订单号
     */
    @Column(columnDefinition = "varchar(50) comment '分销市场订单号'")
    private String marketOrderNum;
    /**
     * '商家角色。当订单为分销订单时,用于区分供应商或者分销商 SELF("默认"),SUPPLIER("供应商"), DISTRIBUTOR("分销商")
     */
    @Column(columnDefinition = "varchar(30) comment '商家角色。当订单为分销订单时,用于区分供应商或者分销商 SELF(\"默认\"),SUPPLIER(\"供应商\"), DISTRIBUTOR(\"分销商\")'")
    @Enumerated(EnumType.STRING)
    private MerchantOrderMerchantRole merchantRole = MerchantOrderMerchantRole.SELF;
    /**
     * 产品 id
     */
    @Column(columnDefinition = "bigint comment '产品 id'")
    private Long productId;
    /**
     * 产品名称
     */
    @Column(columnDefinition = "varchar(200) comment '产品名称'")
    private String productName;
    /**
     * 产品图片
     */
    @Column(columnDefinition = "varchar(200) comment '产品图片'")
    private String logoUrl;
    /**
     * 产品过期退时间
     */
    @Column(columnDefinition = "datetime comment '产品过期退时间'")
    private Date productDateDisabled;
    /**
     * 是否已执行自动退款
     */
    @Column(columnDefinition = "int(1) comment '是否已执行自动退款'")
    private Boolean productRefundableIsRun;
    /**
     * 退货类型 YES("是"), NO("否")
     */
    @Column(columnDefinition = "varchar(200) comment '退货类型 YES(\"是\"), NO(\"否\")'")
    @Enumerated(EnumType.STRING)
    private Whether productRefundable;
    /**
     * 类型 B2C("B2C"), B2C2C("B2C2C"), B2D2C("B2D2C"), B2D2C2C("B2D2C2C")
     */
    @Column(columnDefinition = "varchar(30) comment '类型 B2C(\"B2C\"), B2C2C(\"B2C2C\"), B2D2C(\"B2D2C\"), B2D2C2C(\"B2D2C2C\")'")
    @Enumerated(EnumType.STRING)
    private MerchantOrderPathType pathType;
    /**
     * 产品分销佣金
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '产品分销佣金'")
    private BigDecimal resellFee;
    /**
     * 产品分享返利
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '产品分享返利'")
    private BigDecimal shareFee;
    /**
     * 服务费比率
     */
    @Column(columnDefinition = "varchar(30) comment '服务费比率'")
    private String serveRate;
    /**
     * M/D分享比率
     */
    @Column(columnDefinition = "varchar(30) comment 'M/D分享比率'")
    private String shareRate;
    /**
     * 产品单价
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '产品单价'")
    private BigDecimal singleAmount;
    /**
     * 产品原价
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '产品原价'")
    private BigDecimal baseAmount;
    /**
     * 购买数量
     */
    @Column(columnDefinition = "bigint comment '购买数量'")
    private Long buyCount;
    /**
     * 总金额
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '总金额'")
    private BigDecimal totalAmount;
    /**
     * 优惠后金额
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '优惠后金额'")
    private BigDecimal discountAmount;
    /**
     * 平台id
     */
    @Column(columnDefinition = "bigint comment '平台id'")
    private Long mallId;
    /**
     * 平台订单号
     */
    @Column(columnDefinition = "varchar(30) comment '平台订单号'")
    private String mallOrderNum;
    /**
     * 分享码
     */
    @Column(columnDefinition = "varchar(50) comment '分享码'")
    private String shareCode;
    /**
     * 分享者id
     */
    @Column(columnDefinition = "bigint comment '分享者id'")
    private Long sharerId;
    /**
     * 分享者昵称
     */
    @Column(columnDefinition = "varchar(30) comment '分享者昵称'")
    private String sharerNickName;
    /**
     * 分销码
     */
    @Column(columnDefinition = "varchar(30) comment '分销码'")
    private String salesCode;
    /**
     * 分销商账号
     */
    @Column(columnDefinition = "varchar(30) comment '分销商账号'")
    private String resellerAcct;
    /**
     * 分销商名称
     */
    @Column(columnDefinition = "varchar(30) comment '分销商名称'")
    private String resellerName;
    /**
     * 渠道 id
     */
    @Column(columnDefinition = "varchar(30) comment '渠道 id'")
    private Long channelId;
    /**
     * 渠道码
     */
    @Column(columnDefinition = "varchar(50) comment '渠道码'")
    private String channelSalesCode;
    /**
     * 渠道名称
     */
    @Column(columnDefinition = "varchar(30) comment '渠道名称'")
    private String channelName;
    /**
     * 销售路径
     */
    @Column(columnDefinition = "varchar(30) comment '销售路径'")
    @Enumerated(EnumType.STRING)
    private SellPath sellPath = SellPath.UNKNOWN;
    /**
     * 优惠券id
     */
    @Column(columnDefinition = "bigint comment '优惠券id'")
    private Long couponId;
    /**
     * 优惠券优惠金额
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '优惠券优惠金额'")
    private BigDecimal couponDiscountAmount;
    /**
     * 核销数
     */
    @Column(columnDefinition = "bigint comment '核销数'")
    private Long verifyCount = 0L;
    /**
     * 结算状态 WAIT_SETTLE("待结算"), PART_SETTLE("部分结算"), SETTLED("已结算")
     */
    @Column(columnDefinition = "varchar(30) comment '结算状态 WAIT_SETTLE(\"待结算\"), PART_SETTLE(\"部分结算\"), SETTLED(\"已结算\")'")
    @Enumerated(EnumType.STRING)
    private SettlementStatus settleStatus = SettlementStatus.WAIT_SETTLE;
    /**
     * 礼包id 当礼包下单时，该字段不能为空
     */
    @Column(columnDefinition = "bigint comment '礼包id 当礼包下单时，该字段不能为空'")
    private Long giftPacketId;
    /**
     * 结算时间
     */
    @Column(columnDefinition = "datetime comment '结算时间'")
    private Date dateSettled;

    /**
     * 朋友价
     */
    @Column(columnDefinition = "DECIMAL(30,10) comment '朋友价'")
    private BigDecimal friendPrice;

    public String getMerchantOrderNum() {
        return merchantOrderNum;
    }

    public void setMerchantOrderNum(String merchantOrderNum) {
        this.merchantOrderNum = merchantOrderNum;
    }

    public Long getMerchantOrderId() {
        return merchantOrderId;
    }

    public void setMerchantOrderId(Long merchantOrderId) {
        this.merchantOrderId = merchantOrderId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public String getLogoUrl() {
        return logoUrl;
    }

    public void setLogoUrl(String logoUrl) {
        this.logoUrl = logoUrl;
    }

    public Date getProductDateDisabled() {
        return productDateDisabled;
    }

    public void setProductDateDisabled(Date productDateDisabled) {
        this.productDateDisabled = productDateDisabled;
    }

    public Whether getProductRefundable() {
        return productRefundable;
    }

    public void setProductRefundable(Whether productRefundable) {
        this.productRefundable = productRefundable;
    }

    public Boolean getProductRefundableIsRun() {
        return productRefundableIsRun;
    }

    public void setProductRefundableIsRun(Boolean productRefundableIsRun) {
        this.productRefundableIsRun = productRefundableIsRun;
    }

    public BigDecimal getResellFee() {
        return resellFee;
    }

    public void setResellFee(BigDecimal resellFee) {
        this.resellFee = resellFee;
    }

    public BigDecimal getShareFee() {
        return shareFee;
    }

    public void setShareFee(BigDecimal shareFee) {
        this.shareFee = shareFee;
    }

    public String getServeRate() {
        return serveRate;
    }

    public void setServeRate(String serveRate) {
        this.serveRate = serveRate;
    }

    public String getShareRate() {
        return shareRate;
    }

    public void setShareRate(String shareRate) {
        this.shareRate = shareRate;
    }

    public BigDecimal getSingleAmount() {
        return singleAmount;
    }

    public void setSingleAmount(BigDecimal singleAmount) {
        this.singleAmount = singleAmount;
    }

    public Long getBuyCount() {
        return buyCount;
    }

    public void setBuyCount(Long buyCount) {
        this.buyCount = buyCount;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public Long getMallId() {
        return mallId;
    }

    public void setMallId(Long mallId) {
        this.mallId = mallId;
    }

    public String getMallOrderNum() {
        return mallOrderNum;
    }

    public void setMallOrderNum(String mallOrderNum) {
        this.mallOrderNum = mallOrderNum;
    }

    public Long getMerchantStoreId() {
        return merchantStoreId;
    }

    public void setMerchantStoreId(Long merchantStoreId) {
        this.merchantStoreId = merchantStoreId;
    }

    public String getShareCode() {
        return shareCode;
    }

    public void setShareCode(String shareCode) {
        this.shareCode = shareCode;
    }

    public Long getSharerId() {
        return sharerId;
    }

    public void setSharerId(Long sharerId) {
        this.sharerId = sharerId;
    }

    public String getSharerNickName() {
        return sharerNickName;
    }

    public void setSharerNickName(String sharerNickName) {
        this.sharerNickName = sharerNickName;
    }

    public String getSalesCode() {
        return salesCode;
    }

    public void setSalesCode(String salesCode) {
        this.salesCode = salesCode;
    }

    public String getResellerAcct() {
        return resellerAcct;
    }

    public void setResellerAcct(String resellerAcct) {
        this.resellerAcct = resellerAcct;
    }

    public String getResellerName() {
        return resellerName;
    }

    public void setResellerName(String resellerName) {
        this.resellerName = resellerName;
    }

    public String getChannelSalesCode() {
        return channelSalesCode;
    }

    public void setChannelSalesCode(String channelSalesCode) {
        this.channelSalesCode = channelSalesCode;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public SellPath getSellPath() {
        return sellPath;
    }

    public void setSellPath(SellPath sellPath) {
        this.sellPath = sellPath;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long merchantId) {
        this.merchantId = merchantId;
    }

    public BigDecimal getBaseAmount() {
        return baseAmount;
    }

    public void setBaseAmount(BigDecimal baseAmount) {
        this.baseAmount = baseAmount;
    }

    public Long getVerifyCount() {
        return verifyCount;
    }

    public void setVerifyCount(Long verifyCount) {
        this.verifyCount = verifyCount;
    }

    public BigDecimal getCouponDiscountAmount() {
        return couponDiscountAmount;
    }

    public void setCouponDiscountAmount(BigDecimal couponDiscountAmount) {
        this.couponDiscountAmount = couponDiscountAmount;
    }

    public BigDecimal getDiscountAmount() {
        return discountAmount;
    }

    public void setDiscountAmount(BigDecimal discountAmount) {
        this.discountAmount = discountAmount;
    }

    public MerchantOrderPathType getPathType() {
        return pathType;
    }

    public void setPathType(MerchantOrderPathType pathType) {
        this.pathType = pathType;
    }

    public MerchantOrderMerchantRole getMerchantRole() {
        return merchantRole;
    }

    public void setMerchantRole(MerchantOrderMerchantRole merchantRole) {
        this.merchantRole = merchantRole;
    }

    public Long getGiftPacketId() {
        return giftPacketId;
    }

    public String getMarketOrderNum() {
        return marketOrderNum;
    }

    public void setMarketOrderNum(String marketOrderNum) {
        this.marketOrderNum = marketOrderNum;
    }

    public void setGiftPacketId(Long giftPacketId) {
        this.giftPacketId = giftPacketId;
    }

    public SettlementStatus getSettleStatus() {
        return settleStatus;
    }

    public void setSettleStatus(SettlementStatus settleStatus) {
        this.settleStatus = settleStatus;
    }

    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public Long getChannelId() {
        return channelId;
    }

    public void setChannelId(Long channelId) {
        this.channelId = channelId;
    }


    public Date getDateSettled() {
        return dateSettled;
    }

    public void setDateSettled(Date dateSettled) {
        this.dateSettled = dateSettled;
    }

    public BigDecimal getFriendPrice() {
        return friendPrice;
    }

    public void setFriendPrice(BigDecimal friendPrice) {
        this.friendPrice = friendPrice;
    }

    @Override
    public String toString() {
        return "MerchantOrderItem{" +
                "customerId=" + customerId +
                ", customerName='" + customerName + '\'' +
                ", merchantOrderId=" + merchantOrderId +
                ", merchantOrderNum='" + merchantOrderNum + '\'' +
                ", merchantId=" + merchantId +
                ", merchantStoreId=" + merchantStoreId +
                ", marketOrderNum='" + marketOrderNum + '\'' +
                ", merchantRole=" + merchantRole +
                ", productId=" + productId +
                ", productName='" + productName + '\'' +
                ", logoUrl='" + logoUrl + '\'' +
                ", productDateDisabled=" + productDateDisabled +
                ", productRefundableIsRun=" + productRefundableIsRun +
                ", productRefundable=" + productRefundable +
                ", pathType=" + pathType +
                ", resellFee=" + resellFee +
                ", shareFee=" + shareFee +
                ", serveRate='" + serveRate + '\'' +
                ", shareRate='" + shareRate + '\'' +
                ", singleAmount=" + singleAmount +
                ", baseAmount=" + baseAmount +
                ", buyCount=" + buyCount +
                ", totalAmount=" + totalAmount +
                ", discountAmount=" + discountAmount +
                ", mallId=" + mallId +
                ", mallOrderNum='" + mallOrderNum + '\'' +
                ", shareCode='" + shareCode + '\'' +
                ", sharerId=" + sharerId +
                ", sharerNickName='" + sharerNickName + '\'' +
                ", salesCode='" + salesCode + '\'' +
                ", resellerAcct='" + resellerAcct + '\'' +
                ", resellerName='" + resellerName + '\'' +
                ", channelId=" + channelId +
                ", channelSalesCode='" + channelSalesCode + '\'' +
                ", channelName='" + channelName + '\'' +
                ", sellPath=" + sellPath +
                ", couponId=" + couponId +
                ", couponDiscountAmount=" + couponDiscountAmount +
                ", verifyCount=" + verifyCount +
                ", settleStatus=" + settleStatus +
                ", giftPacketId=" + giftPacketId +
                ", dateSettled=" + dateSettled +
                ", friendPrice=" + friendPrice +
                '}';
    }
}